<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Boxscore Junkie</title>
  <link rel="stylesheet" type="text/css" href="/css/core.css" />
</head>
<body class="yui-skin-sam" onload="initPage({{selDay.year}},{{selDay.month}},{{selDay.day}})">
{% include "header.html" %}
<div id="demo" class="yui-navset">
  <ul class="yui-nav">
      <li><a href="/"><em>2008 Calendar</em></a></li>
      <li><a href="/scoreboard?year={{prevDay.year}}&amp;month={{prevDay.month}}&amp;day={{prevDay.day}}"><em><< Previous Day</em></a></li>
      <li class="selected"><a href="/scoreboard?year={{selDay.year}}&amp;month={{selDay.month}}&amp;day={{selDay.day}}"><em>{{selDay.month}}/{{selDay.day}}</em></a></li>
      <li><a href="/scoreboard?year={{nextDay.year}}&amp;month={{nextDay.month}}&amp;day={{nextDay.day}}"><em>Next Day >></em></a></li>
      <li><a href="/stats"><em>Stats</em></a></li>
  </ul>
  <div class="yui-content">
      <div id="tab1">
        <table cellpadding="0" cellspacing="0">
          <tr>
            <td style="vertical-align: top;">
              <ul class="game-menu">
                <li class="list-header">{{selDay.month}}/{{selDay.day}}</li>
            {% for game in games %}
                {% ifequal game.gameday gid %}
                  <li id="gid_{{game.gameday}}" class="game-selected" onclick="gotoBoxscore(this)" title="">{{game.away_name_abbrev}} @ {{game.home_name_abbrev}}</li>  
                {% else %}
                  <li id="gid_{{game.gameday}}" class="game" onclick="gotoBoxscore(this)" title="">{{game.away_name_abbrev}} @ {{game.home_name_abbrev}}</li>
                {% endifequal %}
            {% endfor %}
              </ul>
            </td>
            <td style="vertical-align: top;">
                <ul class="player-menu">
              {% if boxscore.pitchers %}
                  <li class="list-header">Players</li>
                {% for pitcher in boxscore.pitchers %}
                  {% ifequal pitcher.id pid %}
                  <li id="p{{pitcher.id}}" class="player-selected" onclick="gotoPitcherPBP(this, '{{gid}}')">{{pitcher.pos}} - {{pitcher.name}}, {{pitcher.teamAbbr}}</li>
                  {% else %}
                  <li id="p{{pitcher.id}}" class="player" onclick="gotoPitcherPBP(this, '{{gid}}')">{{pitcher.pos}} - {{pitcher.name}}, {{pitcher.teamAbbr}}</li>
                  {% endifequal %}
                {% endfor %}
              {% endif %}
              {% if boxscore.batters %}
                {% for batter in boxscore.batters %}
                  {% ifequal batter.id bid %}
                  <li id="b{{batter.id}}" class="player-selected" onclick="gotoBatterPBP(this, '{{gid}}')">{{batter.pos}} - {{batter.name}}, {{batter.teamAbbr}}</li>
                  {% else %}
                  <li id="b{{batter.id}}" class="player" onclick="gotoBatterPBP(this, '{{gid}}')">{{batter.pos}} - {{batter.name}}, {{batter.teamAbbr}}</li>
                  {% endifequal %}
                {% endfor %}
              {% endif %}
                </ul>
            </td>
            <td style="vertical-align: top; width: 500px;">
            {% if pitcherPBP %}
              <table>
                <tr><td colspan="6"class="table-header">At Bats</td></tr>
              {% for atbat in pitcherPBP.atbats %}
                {% ifchanged atbat.inning %}
                <tr>
                  <td class="divider">Inning {{atbat.inning}}</td>
                </tr>
                {% endifchanged %}
                <tr>
                  <td>
                    <table class="pitch-sequence" cellpadding="0">
                      <tr><th>&nbsp;</th><th>SPD</th><th>BRK</th><th>PFX</th><th>PITCH</th><th>RESULT</th></tr>
                  {% for pitch in atbat.pitches %}
                    {% if pitch.y0 %}
                      <tr><td class="td-num">{{forloop.counter}}</td><td class="td-spd">{{pitch.start_speed}}</td><td class="td-brk">{{pitch.break_length}}</td><td class="td-pfx">{{pitch.pfx_x}}</td><td class="td-pitch">{{pitch.pitch_type}}</td><td class="td-result">{{pitch.des}}</td></tr>
                    {% else %}
                      <tr><td class="td-num">{{forloop.counter}}</td><td class="td-spd">n/a</td><td class="td-brk">n/a</td><td class="td-pfx">n/a</td><td class="td-pitch">n/a</td><td class="td-result">{{pitch.des}}</td></tr>
                    {% endif %}
                  {% endfor %}
                      <tr><td colspan="6" class="pitch-event">{{atbat.des}}</td></tr>
                    </table>
              {% endfor %}
                  </td>
                </tr>
              </table>
            {% endif %}
            {% if batterPBP %}
              <table>
                <tr><td colspan="6"class="table-header">At Bats</td></tr>
              {% for atbat in batterPBP.atbats %}
                <tr>
                  <td class="divider">Inning {{atbat.inning}}</td>
                </tr>
                <tr>
                  <td>
                    <table class="pitch-sequence" cellpadding="0">
                      <tr><th>&nbsp;</th><th>SPD</th><th>BRK</th><th>PFX</th><th>PITCH</th><th>RESULT</th></tr>
                  {% for pitch in atbat.pitches %}
                    {% if pitch.y0 %}
                      <tr><td class="td-num">{{forloop.counter}}</td><td class="td-spd">{{pitch.start_speed}}</td><td class="td-brk">{{pitch.break_length}}</td><td class="td-pfx">{{pitch.pfx_x}}</td><td class="td-pitch">{{pitch.pitch_type}}</td><td class="td-result">{{pitch.des}}</td></tr>
                    {% else %}
                      <tr><td class="td-num">{{forloop.counter}}</td><td class="td-spd">n/a</td><td class="td-brk">n/a</td><td class="td-pfx">n/a</td><td class="td-pitch">n/a</td><td class="td-result">{{pitch.des}}</td></tr>
                    {% endif %}
                  {% endfor %}
                      <tr><td colspan="6" class="pitch-event">{{atbat.des}}</td></tr>
                    </table>
              {% endfor %}
                  </td>
                </tr>
              </table>
            {% endif %}
            </td>
            <!--
            <td style="vertical-align: top;">
            {% for game in games %}
              <div class="quickbox" style="font-size: .75em">
                Status: {{ game.game_status.status }}<br />
                Indicator:  {{ game.game_status.ind }}<br />
                <table style="background-color: #eaeaea;">
                  <tr>
                    <td>{{game.away_name_abbrev}}</td>
                {% for inning in game.linescore.innings %}
                      <td>{{inning.away}}</td>
                {% endfor %}
                      <td> {{ game.linescore.r.away }}</td>
                      <td> {{ game.linescore.h.away }}</td>
                      <td> {{ game.linescore.e.away }}</td>
                  </tr>
                  <tr>
                    <td>{{game.home_name_abbrev}}</td>
                {% for inning in game.linescore.innings %}
                  {% ifequal inning.home "" %}
                    <td>x</td>
                {% else %}
                    <td>{{inning.home}}</td>
                {% endifequal %}
                      
                {% endfor %}
                      <td> {{ game.linescore.r.home }}</td>
                      <td> {{ game.linescore.h.home }}</td>
                      <td> {{ game.linescore.e.home }}</td>
                      
                  </tr>
                </table>
              </div>
            {% endfor %}
            </td>
            -->
          </tr>
        </table>
      </div>
      <!--
      <div id="tab2"><p>Tab Two Content</p></div>
      <div id="tab3"><p>Tab Three Content</p></div>
      -->
    </div>
</div>
{% include "footer.html" %}
<script type="text/javascript" src="/js/core.js"></script>
</body>
</html>